let v = new Vue({
    el:'#main-container',
    data:{
        meeting:{

        },
        ifJoin:false,
    },
    methods:{
        checkIfJoin:function () {
            axios({
                url:'main/meeting/ifJoin',
            }).then(resp => {
                this.ifJoin = resp.data.obj;
            }).catch(error => {
                layer.msg(error.message);
            })
        },
        joinMeeting:function () {
            axios({
                url:'main/meeting/joinMeeting',
                data:this.meeting,
                method:'post',
            }).then(resp => {
                if(resp.data.success){
                    layer.msg("参加成功");
                    this.ifJoin = true;
                    this.meeting.arrived = this.meeting.arrived + 1;
                    this.meeting.notArrive = this.meeting.notArrive - 1;
                }else{
                    layer.msg("参加会议失败");
                }
            }).catch(error => {
                layer.msg(error.message);
            })
        },
        cencalMeeting:function () {
            axios({
                url:'main/meeting/outMeeting',
                data:this.meeting,
                method:'post',
            }).then(resp => {
                if(resp.data.success){
                    layer.msg("取消成功");
                    this.ifJoin = false;
                    this.meeting.arrived = this.meeting.arrived - 1;
                    this.meeting.notArrive = this.meeting.notArrive + 1;
                }else{
                    layer.msg("取消会议失败");
                }
            }).catch(error => {
                layer.msg(error.message);
            })
        }
    },
    created:function () {
        this.meeting = parent.layer.meeting;
        this.checkIfJoin();
    }
})